<?php

class systemManager extends BaseModule {

    public function __construct() {
        parent::__construct();
    }

    public function writeConfigFile($siteTime, $loginErrorCount, $expiredTime,$pwd_suoding) {
        $re_str .='<?php' . "\r\n";
        $re_str .='/**' . "\r\n";
        $re_str .='* ' . "用户登录配置\r\n";
        $re_str .='*' . "\r\n";
        $re_str .='*/' . "\r\n";
        $re_str .= "define('SITE_TIME', '{$siteTime}');" . "\r\n";
        $re_str .= "define('USER_LOGIN_ERROR', '{$loginErrorCount}'); " . "\r\n";
        $re_str .= "define('EXPIRED_TIME', '{$expiredTime}'); " . "\r\n";
        $re_str .= "define('PWD_SUODING_TIME', '{$pwd_suoding}'); " . "\r\n";
        $re_str .= '?>' . "\r\n";


        $filename = DATA_PATH . 'systemConfig.class.php';
        if (is_writable($filename)) {
            if (!$handle = fopen($filename, 'w')) {
                return 1;
                //"不能打开文件 $filename";
            }
            if (fwrite($handle, $re_str) === FALSE) {
                return 2;
                //return "不能写入到文件 $filename";
            }
            fclose($handle);
            return 0;
        } else {
            return 3;
            //return "文件 $filename 不可写";
        }
    }

}